package cn.weiyang.action;

import cn.weiyang.biz.DistrictBiz;
import cn.weiyang.biz.DistrictBizImpl;
import cn.weiyang.entity.District;
import com.google.gson.Gson;

import java.io.IOException;
import java.util.List;

/**
 * Created by Administrator on 2017/7/10.
 */
public class DistrictAction extends BaseAction{
    public String queryDistrict() throws IOException {
        DistrictBiz db=new DistrictBizImpl();
        List<District> districts=db.queryDistrict();
        Gson gson = new Gson();
        //在这里转化成json
        String json =gson.toJson(districts);
        getResponse().setContentType("application/json;charset=UTF-8");
        getResponse().getWriter().println(json);
        return null;
    }
}
